package com.ef.constant;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.ef.util.CalendarUtil;

public enum ETimeline {
	T0900to1000("09:00-10:00"), T1015to1115("10:15-11:15"), T1130to1230(
			"11:30-12:30"), T1245to1345("12:45-13:45"), T1400to1500(
			"14:00-15:00"), T1515to1615("15:15-16:15"), T1630to1730(
			"16:30-17:30"), T1745to1845("17:45-18:45"), T1900to2000(
			"19:00-20:00"), T2015to2115("20:15-21:15"), T0930to1030(
			"09:30-10:30"), T1045to1145("10:45-11:45"), T1200to1300(
			"12:00-13:00"), T1315to1415("13:15-14:15"), T1430to1530(
			"14:30-15:30"), T1600to1700("16:00-17:00"), T1715to1815(
			"17:15-18:15");

	private String message;

	private Date startTime;

	private Date endTime;

	private ETimeline(String message) {
		if (message.trim().equals("09:00-10:00")) {
			startTime = CalendarUtil.getTime(9, 0, 0);
			endTime = CalendarUtil.getTime(10, 0, 0);
		} else if (message.trim().equals("10:15-11:15")) {
			startTime = CalendarUtil.getTime(10, 15, 0);
			endTime = CalendarUtil.getTime(11, 15, 0);
		} else if (message.trim().equals("11:30-12:30")) {
			startTime = CalendarUtil.getTime(11, 30, 0);
			endTime = CalendarUtil.getTime(12, 30, 0);
		} else if (message.trim().equals("12:45-13:45")) {
			startTime = CalendarUtil.getTime(12, 45, 0);
			endTime = CalendarUtil.getTime(13, 45, 0);
		} else if (message.trim().equals("14:00-15:00")) {
			startTime = CalendarUtil.getTime(14, 0, 0);
			endTime = CalendarUtil.getTime(15, 0, 0);
		} else if (message.trim().equals("15:15-16:15")) {
			startTime = CalendarUtil.getTime(15, 15, 0);
			endTime = CalendarUtil.getTime(16, 15, 0);
		} else if (message.trim().equals("16:30-17:30")) {
			startTime = CalendarUtil.getTime(16, 30, 0);
			endTime = CalendarUtil.getTime(17, 30, 0);
		} else if (message.trim().equals("17:45-18:45")) {
			startTime = CalendarUtil.getTime(17, 45, 0);
			endTime = CalendarUtil.getTime(18, 45, 0);
		} else if (message.trim().equals("19:00-20:00")) {
			startTime = CalendarUtil.getTime(19, 0, 0);
			endTime = CalendarUtil.getTime(20, 0, 0);
		} else if (message.trim().equals("20:15-21:15")) {
			startTime = CalendarUtil.getTime(20, 15, 0);
			endTime = CalendarUtil.getTime(21, 15, 0);
		} else if (message.trim().equals("09:30-10:30")) {//
			startTime = CalendarUtil.getTime(9, 30, 0);
			endTime = CalendarUtil.getTime(10, 30, 0);
		} else if (message.trim().equals("10:45-11:45")) {
			startTime = CalendarUtil.getTime(10, 45, 0);
			endTime = CalendarUtil.getTime(11, 45, 0);
		} else if (message.trim().equals("12:00-13:00")) {
			startTime = CalendarUtil.getTime(12, 0, 0);
			endTime = CalendarUtil.getTime(13, 0, 0);
		} else if (message.trim().equals("13:15-14:15")) {
			startTime = CalendarUtil.getTime(13, 15, 0);
			endTime = CalendarUtil.getTime(14, 15, 0);
		} else if (message.trim().equals("14:30-15:30")) {
			startTime = CalendarUtil.getTime(14, 30, 0);
			endTime = CalendarUtil.getTime(15, 30, 0);
		} else if (message.trim().equals("16:00-17:00")) {
			startTime = CalendarUtil.getTime(16, 0, 0);
			endTime = CalendarUtil.getTime(17, 0, 0);
		} else if (message.trim().equals("17:15-18:15")) {
			startTime = CalendarUtil.getTime(17, 15, 0);
			endTime = CalendarUtil.getTime(18, 15, 0);
		}
		this.message = message;
	}

	public String toString() {
		return message;
	}

	public String getName() {
		return this.name();
	}

	static public ETimeline messageOf(String msg) {
		if (msg == null || msg.trim().length() == 0) {
			return null;
		}
		if (msg.trim().equals("09:00-10:00")) {
			return T0900to1000;
		}
		;
		if (msg.trim().equals("10:15-11:15")) {
			return T1015to1115;
		}
		if (msg.trim().equals("11:30-12:30")) {
			return T1130to1230;
		}
		if (msg.trim().equals("12:45-13:45")) {
			return T1245to1345;
		}
		if (msg.trim().equals("14:00-15:00")) {
			return T1400to1500;
		}
		if (msg.trim().equals("15:15-16:15")) {
			return T1515to1615;
		}
		if (msg.trim().equals("16:30-17:30")) {
			return T1630to1730;
		}
		if (msg.trim().equals("17:45-18:45")) {
			return T1745to1845;
		}
		if (msg.trim().equals("19:00-20:00")) {
			return T1900to2000;
		}
		if (msg.trim().equals("20:15-21:15")) {
			return T2015to2115;
		}
		if (msg.trim().equals("09:30-10:30")) {//
			return T0930to1030;
		}
		if (msg.trim().equals("10:45-11:45")) {
			return T1045to1145;
		}
		if (msg.trim().equals("12:00-13:00")) {
			return T1200to1300;
		}
		if (msg.trim().equals("13:15-14:15")) {
			return T1315to1415;
		}
		if (msg.trim().equals("14:30-15:30")) {
			return T1430to1530;
		}
		if (msg.trim().equals("16:00-17:00")) {
			return T1600to1700;
		}
		if (msg.trim().equals("17:15-18:15")) {
			return T1715to1815;
		}
		return null;
	}

	static public List<ETimeline> getWeekendTimeline() {
		List<ETimeline> timeline = new ArrayList<ETimeline>();
		timeline.add(ETimeline.T0930to1030);
		timeline.add(ETimeline.T1045to1145);
		timeline.add(ETimeline.T1200to1300);
		timeline.add(ETimeline.T1315to1415);
		timeline.add(ETimeline.T1430to1530);
		timeline.add(ETimeline.T1600to1700);
		timeline.add(ETimeline.T1715to1815);
		timeline.add(ETimeline.T1745to1845);
		timeline.add(ETimeline.T1900to2000);
		timeline.add(ETimeline.T2015to2115);
		return timeline;
	}
	static public List<ETimeline> getNomarlTimeline() {
		List<ETimeline> timeline = new ArrayList<ETimeline>();
		timeline.add(ETimeline.T0900to1000);
		timeline.add(ETimeline.T1015to1115);
		timeline.add(ETimeline.T1130to1230);
		timeline.add(ETimeline.T1245to1345);
		timeline.add(ETimeline.T1400to1500);
		timeline.add(ETimeline.T1515to1615);
		timeline.add(ETimeline.T1630to1730);
		timeline.add(ETimeline.T1745to1845);
		timeline.add(ETimeline.T1900to2000);
		timeline.add(ETimeline.T2015to2115);
		return timeline;
	}
	


	public Date getStartTime() {
		return startTime;
	}

	public Date getEndTime() {
		return endTime;
	}
}
